﻿// Silver.Globe, version 0.11 for Silverlight 1.1 Alpha
// Copyright © Florian Krüsch (xaml-kru.com)
// xaml-kru.com/silverglobe
// This source is subject to the Microsoft Public License (Ms-PL).
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx.
// All other rights reserved.

using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SilverGlobe.Data;

namespace SilverglobeSample
{
    public partial class LocationInfo : Canvas
    {
        private Storyboard _fadeIn;

        public LocationInfo()
        {
            InitializeComponent();

            _fadeIn = (Storyboard)Resources["FadeIn"];

            Hide();
        }

        /// <summary>
        /// Show the control and fade in the background.
        /// </summary>
        public void Show(Location location)
        {
            _cityInfo.Text = location.Name;
            _latitudeInfo.Text = location.Position.LatitudeString;
            _longitudeInfo.Text = location.Position.LongitudeString;

            Visibility = Visibility.Visible;

            _fadeIn.Begin();
        }

        /// <summary>
        /// Hide the control.
        /// </summary>
        public void Hide()
        {
            Visibility = Visibility.Collapsed;
        }
    }
}
